package com.houger.ddd.seckill.constant;

import java.util.Arrays;

public enum TokenIssueTypeEnum {

    AUTO_CALC(0,"自动发放"),
    FROM_TASK(1,"任务获取"),

    ;


    private int value;
    private String desc;

    TokenIssueTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static TokenIssueTypeEnum getEnumByCode(int value) {
        return Arrays.stream(TokenIssueTypeEnum.values()).filter(a -> a.value == value).findFirst().orElse(AUTO_CALC);
    }

}
